package com.shareit.ocr.domain.simulator;

import java.util.ArrayList;
import java.util.List;
import com.shareit.ocr.enums.SimulatorEnum;

public class SimulatorFactory {
	
	public static List<BaseSimulator> createInstances(SimulatorEnum se){
		
		List<BaseSimulator> simulators = new ArrayList<BaseSimulator>();
		if(se == SimulatorEnum.API || se == SimulatorEnum.API_WEB ) {
			BaseSimulator simulator = new APISimulator();
			simulators.add(simulator);
		}
		if(se == SimulatorEnum.API_WEB) {
			BaseSimulator simulator = new WebSimulator();
			simulators.add(simulator);
		}
		if(se == SimulatorEnum.WEB || se == SimulatorEnum.WEB_API) {
			BaseSimulator simulator = new WebSimulator();
			simulators.add(simulator);
		}
		if(se == SimulatorEnum.WEB_API) {
			BaseSimulator simulator = new APISimulator();
			simulators.add(simulator);
		}
		
		return simulators;
	}
	
	public static List<BaseSimulator> createInstances(String simulatorType) throws Exception{
		SimulatorEnum se = SimulatorEnum.valueOf(simulatorType);
		if(se == null) {
			throw new Exception("invalid simulatorType");
		}
		return SimulatorFactory.createInstances(se);
	}
	

}
